#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "common.h"

#include <QtGui/QMainWindow>
#include <QThread>
#include <QTimer>
//#include "ui_mainwindow.h"
#include "auxilary.h"

class Controller;

struct CircleData
{
    CircleData () : x ( 0 ), y ( 0 ), radius ( 0 ) {}
    CircleData ( int x, int y, int radius, QColor color )
        : x ( x ), y ( y ), radius ( radius ), color ( color ) {}

    int x;
    int y;
    int radius;
    QColor color;
};

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
    MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~MainWindow();

    void AddCircle ( int x, int y, int radius, QColor color );
    void MoveCircle ( int index, int xTo, int yTo );
    void SetMassCenter ( const Point2D & massCenter );

    void SetModel ( Controller * controller );

protected slots:
    void paintEvent ( QPaintEvent * e );
    void closeEvent ( QCloseEvent * event );

    void onTimerEvent ();

private:
    vector<CircleData> circleDataVect;
    Controller * controller;
    QTimer timer;
    Point2D massCenter;
};

#endif // MAINWINDOW_H
